package tools

import (
	"C"
	"math"
)

/**
 * @author ljfirst
 * @version V1.0
 * @date 2023/6/26 06:20
 * @author-Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description
 * */

// 获取最大值
func Max(value ...int) int {
	temp := value[0]
	for _, v := range value {
		if v > temp {
			temp = v
		}
	}
	return temp
}

// 获取最小值
func Min(value1, value2 int) int {
	if value1 > value2 {
		return value2
	}
	return value1
}

// 比较绝对值大小
func CompAbs(a, b int) int {
	if a < 0 {
		a = -a
	}
	if b < 0 {
		b = -b
	}
	return a - b
}

// 获取绝对值
func GetAbs(a, b int) (absA, absB int) {
	if a < 0 {
		a = -a
	}
	if b < 0 {
		b = -b
	}
	return a, b
}

// 获取数字的四舍五入值
func Round(num float64) float64 {
	return math.Floor(num + 0.5)
}
